package com.cn.springcloudwechat.controller.personalcenter;

import com.cn.springcloudwechat.common.ajax.AjaxRes;
import com.cn.springcloudwechat.common.utils.base.Const;
import com.cn.springcloudwechat.model.YmChildGrowthRepo;
import com.cn.springcloudwechat.service.personalcenter.service.YmChildGrowthRepoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author Lg
 * @Date 2018/8/24 16:57
 * @Content
 */
@RestController
@RequestMapping("/web/")
public class ChildGrowthRepoController {

    @Autowired
    YmChildGrowthRepoService ymChildGrowthRepoService;

    @RequestMapping("getChildGrowthRepo")
    public AjaxRes getChildGrowthRepo(AjaxRes ajaxRes,Short sex){
        try{
            List<YmChildGrowthRepo> ymChildGrowthRepos =ymChildGrowthRepoService.getALl(sex);
            ajaxRes.setSucceed(ymChildGrowthRepos, Const.DATA_SUCCEED);
        }catch (Exception e){
            ajaxRes.setFailMsg(e.getMessage());
        }
        return ajaxRes;
    }

}
